<%--                                                                       --%>
<%-- Copyright (c) 2001-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

<script language="JavaScript">

function closeWindow() {
  self.close();
}

function setFolderOwner(theForm) {

  var userList = new Array;
  var checkbox = theForm.ownerIds;
  var index = 0; 
  if ( checkbox != null ) {
    var len = checkbox.length;
    if ( len > 1 ) {
      for ( var i=0; i<len; i++ ) {
        if ( checkbox[i].checked ) {
          userList[index] = checkbox[i].value;
          index++;
        }
      }
    } else {
      if ( checkbox.checked ) {
        userList[0] = checkbox.value;
      }
    }

  }

  if (userList.length == 0) {
    alert("<bean:message key="cs.error.owner"/>");
    return false;  
  }
  window.opener.setOwner(userList);
  closeWindow();
}
</script>


<!-- BEGIN form ( csFolderSelectOwnerForm ) -------------------------->
<html:form action="/cs/contentSelectOwner.do">
  <bvhtml:hiddenList name="micrositeNaviInfoView" property="urlParams" scope="request"/>
<!-- Zone 5 starts here.  -->
      
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" 
       summary="content area">
  <tr>
    <td valign="top">
	
	<!-- close window button here -->
	  <div class="generalWrapRight">
        <html:button property="closeBtn" titleKey="button.close.window" styleClass="inputButton" onclick="javascript:closeWindow()">
          <bean:message key="button.close.window" />
        </html:button>
      </div>
	<!-- end button -->
	
    <!--start page title here-->
      <div class="pageTitle">
        <span class="left">
          <bean:message key="cs.folder.select.owner"/>
        </span>
        <span class="right">
          &nbsp;</span>

      </div> 
    <!--end page title here-->
    
    <!--start sub title bar here-->
    <div class="pageSubtitle">
      <span class="left">
        <bean:message key="cs.select.owner"/>
      </span>
	  <span class="right">&nbsp;</span>
    </div>  
    
    <div class="blockWrap">
      
    <!-- start Page Instructions -->
    <div class="pageInstructions">
      <bean:message key="cs.folder.select.owner.note"/>
    </div>
    <!-- End Page Instructions -->
      
    <!--start main content area here-->
    <table class="dataTable" width="100%" border="0" cellspacing="1" 
           cellpadding="2" summary='<bean:message key="cs.content.select.owner"/>'>
    <logic:empty name="csFolderSelectOwnerView" property="availableOwnerCandidates">
      <tr class="listOdd">
	<td align="center" colspan=3><bean:message key="cs.no.group.members"/>
	</td>
      </tr>
    </logic:empty>
    <logic:notEmpty name="csFolderSelectOwnerView" property="availableOwnerCandidates">
      <tr class="listHeader"> 
	<th id="select" align="center"><bean:message key="cs.select"/></th>
	<th id="name" align="left"><bean:message key="cs.name"/></th>
      </tr>

      <bean:define id="curOwnerId" name="csFolderSelectOwnerForm" property="ownerIds[0]" />
      <logic:iterate id="oneUser" name="csFolderSelectOwnerView" property="availableOwnerCandidates" indexId="index" type="org.apache.struts.util.LabelValueBean">
        <%
          String checkedStr = (curOwnerId.toString().equals((String)oneUser.getValue())) ? "CHECKED" : "";
        %>
	<tr class='<%= index.intValue() % 2 == 0 ? "listEven" : "listOdd"%>'>
	  <td headers="select" align="center">
            <input type="checkbox" <%=checkedStr%> name="ownerIds" value='<bean:write name="oneUser" property="value"/>##<bean:write name="oneUser" property="label"/>' >
	  </td>
	  <td headers="name" align="left"><bean:write name="oneUser" property="label" /></td>
	</tr>
      </logic:iterate>
    </logic:notEmpty> 

  </table> 
  <div class="pageButtonWrap" align="right">  
    <html:button property="setOwner" titleKey="cs.button.set.owner" onclick="setFolderOwner(this.form)" styleClass="pageButton">
      <bean:message key="cs.button.set.owner"/>
    </html:button>
  </div>  

</html:form>
  
<!-- END form ( csFolderSelectOwnerForm ) ---------------------------->
